package com.bwie.doctor.service.impl;

import com.bwie.doctor.domain.po.MedDoctor;
import com.bwie.doctor.domain.po.MedPatient;
import com.bwie.doctor.domain.po.MedRegistered;
import com.bwie.doctor.mapper.MedRegisteredMapper;
import com.bwie.doctor.service.MedRegisteredService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MedRegisteredServiceImpl implements MedRegisteredService {
    @Autowired
    private MedRegisteredMapper medRegisteredMapper;

    /**
     * 取消挂号
     * @param realName
     * @param patientName
     */
    @Override
    public void cancelDoctorState(String realName,String patientName) {

        //医生信息
        MedDoctor medDoctor = medRegisteredMapper.queryDoctor(realName);

        //患者信息
        MedPatient medPatient = medRegisteredMapper.queryPatient(patientName);

        //取消挂号
        medRegisteredMapper.UpddoctorState(medDoctor.getDoctorId(),medPatient.getId(),1);
    }

    /**
     * 新增挂号
     */
    @Override
    public void register(String dockerName,String patientName){

        medRegisteredMapper.registered(dockerName,patientName);
    }


    /**
     * 查询患者挂号
     */
    @Override
    public MedRegistered registerdFindByi(String dockerName) {
        MedRegistered medRegistered = medRegisteredMapper.registerdFindByi(dockerName);
        return medRegistered;
    }

}
